﻿using System.Linq;
using DataModel.Models;

namespace DataModel.Managers
{
    public class ChairManager
    {
        readonly UniversityPortalEntities _entityModel;

        public ChairManager()
        {
            _entityModel = new UniversityPortalEntities();
        }


        public ChairModel GetChairModel(Chair chair)
        {
            var chairModel = new ChairModel {Description = chair.description, FullName = chair.fullName};
            var userManager = new UserManager();
            foreach(var professor in chair.Professors)
            {
                userManager.GetProfessor(professor);
            }
            return chairModel;
        }

        public IQueryable<Professor> GetChairProfessors(Chair chair)
        {
            return from professor in _entityModel.Professors
                   where (professor.chairID == chair.ID)
                   select professor;
        }
    }
}
